/*
 * DbStudentAddress.h
 *
 *  Created on: 24 Apr 2010
 *      Author: Vastsor
 */

#ifndef STUDENTADDRESSDB_H_
#define STUDENTADDRESSDB_H_

#include "IStudentAddressDb.h"

#include <string>

using namespace std;

class StudentAddressDb:public IStudentAddressDb {
public:
	StudentAddressDb();
	StudentAddressDb(const string *dbName, const string *user, const string *passwd);
	virtual ~StudentAddressDb();
	virtual bool saveAddress(const string *id, const string *streetName,const string *streetNumber, const string *town) const;
	/**
	 *Get maximum value of StudentAddresses.id plus one
	 *if StudentAddresses is empty returns '1'
	 * @return string *
	 */
	virtual string *getLastId()const;


	/**
	 * Set/update the fk StudentA_id by aem
	 * @param aem, the value of aem
	 * @param id, the value of id
	 * @return boolean
	 */
	virtual bool saveStudentAddress(const string *aem,const string *id) const;
	/**
	 * Search a address with
	 * @param streetName, address's street
	 * @param streetNumber, address's number
	 * @param town, address's town
	 * @return pointer to const string , the id of address
	 */

	virtual string *getIdByAddress(const string *streetName, const string *streetNumber, const string *town) const;
protected:
	/**
	 * Check if StudentAddresses is empty
	 * @return boolean true if table is empty or boolean false if table is not empty
	 */
	bool isEmpty() const;
};

#endif /* STUDENTADDRESSDB_H_ */
